package NewGW;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.GridLayout;
import java.util.ArrayList;

import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JCheckBox;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.border.TitledBorder;

import utils.BasePanel;
import utils.lignOptions;
import utils.variable;
import NewUserMisc.templateUserMaker;
import NewUserMisc.templateUserReader;
import Window.Fenetre;

public class CollecteGW extends BasePanel
	{
	/************
	 * Variables
	 ************/
	Fenetre maFenetre;
	public ArrayList<lignOptions> optionList;
	String[] tabOption;
	JCheckBox selectAll;
	
	/****************
	 * Constructeurs
	 ****************/
	public CollecteGW(Fenetre maFenetre)
		{
		/**
		 * Variables
		 */
		this.maFenetre = maFenetre;
		optionList = new ArrayList<lignOptions>();
		selectAll = new JCheckBox("Check all");
		
		if(variable.getTargetOption("communicationMode").compareTo("SSH")==0)
			{
			variable.setSautDeLigne("\n");
			}
		else
			{
			variable.setSautDeLigne("\r\n");
			}
		
		/***********************
		 * Option definition
		 */
		tabOption = new String[]{"Serial config",variable.getTargetOption("communicationMode")+" Config","IOS Upgrade","Backup config","Upload MOH"};
		
		utils.variable.setOptions(new boolean[tabOption.length]);
		
		//Disposition
		choixOptions.setLayout(new FlowLayout());
		choixOptions.setPreferredSize(new Dimension(maFenetre.getWidth(),65));
		
		for(int i=0;i<tabOption.length;i++)
			{
			optionList.add(new lignOptions(tabOption[i]));
			}
		
		for(int i=0;i<optionList.size();i++)
			{
			choixOptions.add(optionList.get(i));
			}
		
		//Selection of all Options Check box
		optionSelectAll(true);
		selectAll.setSelected(true);
		/**********************/
		
		Vccm.setVisible(false);
		Cversion.setVisible(false);
		panneau.add(selectAll);
		
		//Event
		CollecteGWProcess myProcess = new CollecteGWProcess(this);
		launch.addActionListener(myProcess);
		selectAll.addActionListener(myProcess);
		}
	
	
	
	/****************************************
	 * Method used to select or deselect all
	 * the options check box 
	 ****************************************/
	public void optionSelectAll(boolean bool)
		{
		for(int i=0;i<optionList.size();i++)
			{
			optionList.get(i).getBobox().setSelected(bool);
			}
		}
	
	/*2012*//*RATEL Alexandre 8)*/
	}
